UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fQAUzkHmemIy2vnE6J5gysZ9oL4GVYzxOWCoyOD3qXk=' 
WHERE 
  key_id = '458407a50f948972f9d62030b0c6438c189eff8c9907f502d4b48f12fd77f8f5' 
  AND (
    token = 'fQAUzkHmemIy2vnE6J5gysZ9oL4GVYzxOWCoyOD3qXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026