UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uWAh+rswnwkyqt/3jqF68WuKZXb7bKiZJqtYuMbQ+Ms=' 
WHERE 
  key_id = '9b4358492f8fd714a9763418877acaf6ef5d748c939681cdc04929643355730a' 
  AND (
    token = 'uWAh+rswnwkyqt/3jqF68WuKZXb7bKiZJqtYuMbQ+Ms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030