UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ilB2n0F1jrgENoHNX8k3pf7o1IM5NRAgZHbcr1VJvvc=' 
WHERE 
  key_id = 'b20fe3f3370a0752e7081b2896fa56a30b4215b652e4f9400fd9dc102cc03f75' 
  AND (
    token = 'ilB2n0F1jrgENoHNX8k3pf7o1IM5NRAgZHbcr1VJvvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030