UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rwkDUlLZh+1RHjWQwGU5NQGqy7iAdVgBOOm+7zdv2q0=' 
WHERE 
  key_id = 'f58321267f25c16eb4a53f805d14f5d69e77b2e5bc8f5fd13b7801763b93b742' 
  AND (
    token = 'rwkDUlLZh+1RHjWQwGU5NQGqy7iAdVgBOOm+7zdv2q0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044