UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MJImyD6oaZAnEppuqHOegr3553v/N6YS+brrwl/rxP0=' 
WHERE 
  key_id = '516f969af76bd1d945b9544a56f6844493e9bc7c9bd9952e84cff21ba09646f1' 
  AND (
    token = 'MJImyD6oaZAnEppuqHOegr3553v/N6YS+brrwl/rxP0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064