UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SyoKIvp/f2gpdRe0xk4xKv+zei92akE3pylR/3nkK+w=' 
WHERE 
  key_id = '381693d95241084480fb5e67d22a12a68277b0e05fbeabd35f02bf1efd7ba10d' 
  AND (
    token = 'SyoKIvp/f2gpdRe0xk4xKv+zei92akE3pylR/3nkK+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035