UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l6fwJU8gScdXX8fyxMmSO6kfs+bBf75ZYSosM3ZI+Jk=' 
WHERE 
  key_id = '12fff11feaa83f02596128086f1e988c9d7498c378a75a5bf4158240af19cc2b' 
  AND (
    token = 'l6fwJU8gScdXX8fyxMmSO6kfs+bBf75ZYSosM3ZI+Jk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038