UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fJMgv0QrPmgomT0QQA0gvoWuoVpq8PI+68JGVcrcKXk=' 
WHERE 
  key_id = '522e41ff4d1947d715fe9d9d4ea615926c80628ab5863c127e37f7d675f4a445' 
  AND (
    token = 'fJMgv0QrPmgomT0QQA0gvoWuoVpq8PI+68JGVcrcKXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033