UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YwHPUKdfNMh3nvND/4X2fjpJfCPrbmavC+JIwxgtEm8=' 
WHERE 
  key_id = '475ea11d34ca8e5387d305d53a0036043243b374ed63a22b6f97ffd3b8a20725' 
  AND (
    token = 'YwHPUKdfNMh3nvND/4X2fjpJfCPrbmavC+JIwxgtEm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030