UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hePkVO+JC3O4qQ+NuGhKhqzqkd19NCRvBmm9PUo+A60=' 
WHERE 
  key_id = '9b6eb674050965e5fb250e67d6d38de752812fb9eecea0c5f6e4fdb4a0bd8af2' 
  AND (
    token = 'hePkVO+JC3O4qQ+NuGhKhqzqkd19NCRvBmm9PUo+A60=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024