UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xd0+GE9GfH/CthEYHMLRnJIAZ56JMvt3pvOYVg1OfEs=' 
WHERE 
  key_id = '974820f564fb47a11062fe9af37d4ce9d1e07f681c796b330516b8816cd8757e' 
  AND (
    token = 'xd0+GE9GfH/CthEYHMLRnJIAZ56JMvt3pvOYVg1OfEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055