UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LQSfaFQMS5CI2KPFRdRCMr+PW63lNn1ijBjwHkCmzhk=' 
WHERE 
  key_id = '162ad5c7b1928f14e938cfcb848360805f350ef927e1ff45545bbe4b78aaf7ae' 
  AND (
    token = 'LQSfaFQMS5CI2KPFRdRCMr+PW63lNn1ijBjwHkCmzhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028