UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ci2NKpRd6EJ/TpXrwJpzppHiBxMv/sRpTnvcEFtWrSQ=' 
WHERE 
  key_id = 'd288bd2ee84afe23f650c8065cd3b37ed603b2ad91dda8287115c46cf9d12bb2' 
  AND (
    token = 'ci2NKpRd6EJ/TpXrwJpzppHiBxMv/sRpTnvcEFtWrSQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034