UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't4HmppWsPRNxrOaYxCUJqdJi/7i1Fb6Eq7Pur3nkaZg=' 
WHERE 
  key_id = '3eecf28d232be5389478215037b5152212d840a2efeb83b631654bee328e16f8' 
  AND (
    token = 't4HmppWsPRNxrOaYxCUJqdJi/7i1Fb6Eq7Pur3nkaZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032