UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BywBp2fIqItXtR52P5a7h+qReUhug3RM79JqVdBh6TA=' 
WHERE 
  key_id = '680a0cb22a176b392d2c5953b204f8abe8b15bb81bdf9428b5413ce593c3206b' 
  AND (
    token = 'BywBp2fIqItXtR52P5a7h+qReUhug3RM79JqVdBh6TA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043