UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aJPyWv2UEXNFMLo+bwPPacPeSCdKxWhKIEpYT854+qY=' 
WHERE 
  key_id = '38fddd3a4a4a4954cf183b9a11a658e030ff7772346871a09d24b1ba4b469482' 
  AND (
    token = 'aJPyWv2UEXNFMLo+bwPPacPeSCdKxWhKIEpYT854+qY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032