UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DFO5GZp9Om1RCJX/5WyafLbwCfO7SdITMseFzqE8YBc=' 
WHERE 
  key_id = '646ebf572a3d20a1103f4cc41f76a179c59487770c5441df0dbe1693d4daff1b' 
  AND (
    token = 'DFO5GZp9Om1RCJX/5WyafLbwCfO7SdITMseFzqE8YBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028