UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q/enIq1meggJnOnEDGmc9oXeoSpCqWGtEQwdj1asKN0=' 
WHERE 
  key_id = '1bb5859d7b5b6798e34c99c21b136346c4d03f54162e3dbcf70b029f6f248486' 
  AND (
    token = 'q/enIq1meggJnOnEDGmc9oXeoSpCqWGtEQwdj1asKN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057