UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qwz4nFzYBTDgSpW6pqSnTJoji0zs7n4LJZvwdgOv+Hk=' 
WHERE 
  key_id = '61a2c03cff80930c3396a3781c3e42a5e5306f62756c3cc038248bb254be0c8f' 
  AND (
    token = 'Qwz4nFzYBTDgSpW6pqSnTJoji0zs7n4LJZvwdgOv+Hk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048