UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xs50goyGmSh7ICQq5+5PpqR1XAlg928ps6gmGmdbIFc=' 
WHERE 
  key_id = '4ab8cfb88895584d9266d54f98e60af0f621e60be8a211febd5299eb02cff067' 
  AND (
    token = 'xs50goyGmSh7ICQq5+5PpqR1XAlg928ps6gmGmdbIFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028