UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7PD3LwFMBkBZSO5zXXa9i57FLh7mvo+PpQxWA7c7j9Y=' 
WHERE 
  key_id = 'a4fd8321844f460d0df38be272c0a1d4baf6de939e7917c6415601a47b4fbd70' 
  AND (
    token = '7PD3LwFMBkBZSO5zXXa9i57FLh7mvo+PpQxWA7c7j9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044