UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T+EOdy2dhIiIhgFqZFi5oeXuUs6j9M2PRPyWyQI/uPQ=' 
WHERE 
  key_id = '39d556ec2ccda5b429afc263cb3c9e3bf6a37607787fd7d107cccc3c79a5db3d' 
  AND (
    token = 'T+EOdy2dhIiIhgFqZFi5oeXuUs6j9M2PRPyWyQI/uPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061