UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Br0Km7WNTSrecsDRLDRfBtQ3aNT9/6nDewYzvN+fZIA=' 
WHERE 
  key_id = 'eeaa231cb3438e6a768b4d254548cb7835dc49cf10a60cebc7294a74d3e19d02' 
  AND (
    token = 'Br0Km7WNTSrecsDRLDRfBtQ3aNT9/6nDewYzvN+fZIA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024