UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SmIYqo/5lP85mp0xP6Ahg+ftCYbdr6o6QczzK281fOc=' 
WHERE 
  key_id = '64cbfdbd7f975df44910c5d944b43ec60053ac834f51aa5131a66ae596160003' 
  AND (
    token = 'SmIYqo/5lP85mp0xP6Ahg+ftCYbdr6o6QczzK281fOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040