UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bNwVjzdaPGjnV1427OlYRIcNTZ00V7c3X09urPFbvf8=' 
WHERE 
  key_id = '240aa918207ded08319efef12c59b0d841fae4d0ea1658a9ec99faa3a4d83d50' 
  AND (
    token = 'bNwVjzdaPGjnV1427OlYRIcNTZ00V7c3X09urPFbvf8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030