UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tpqN//w38aRFcD2Pu49Tp0/m1V8sG7DIewl5YUd6lwQ=' 
WHERE 
  key_id = '171d15b5a21665ab0ad9aeba84da6434734dffbbdbcbc89829cfb136f0986351' 
  AND (
    token = 'tpqN//w38aRFcD2Pu49Tp0/m1V8sG7DIewl5YUd6lwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029