UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LxwL6weHHEZC0Ta/oyaFl5/8IJFtJw4QXyVhtRxOvXw=' 
WHERE 
  key_id = 'f08b6d213f90d9911591a922b138326bacd01c7da6c517800a5826c638abf1ad' 
  AND (
    token = 'LxwL6weHHEZC0Ta/oyaFl5/8IJFtJw4QXyVhtRxOvXw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021