UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8yYw+07XiAuY1r0FftV9qSICjqjjn171++Li2BBNUu4=' 
WHERE 
  key_id = 'ed4dd064784fbed0bd8f88295cd0a94d759925c52b4d5c88b52f5e60dd5c21a0' 
  AND (
    token = '8yYw+07XiAuY1r0FftV9qSICjqjjn171++Li2BBNUu4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020