UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZJDGJ4xzqzz5uFfaWakjmqGmKcGgb8tHRPHVOy9XLTQ=' 
WHERE 
  key_id = 'c87fd8cd115a345cf490ce25e9349a4a0ee81a1c0e6049e7dc5467c9e97f520a' 
  AND (
    token = 'ZJDGJ4xzqzz5uFfaWakjmqGmKcGgb8tHRPHVOy9XLTQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025