UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd6Xnib2Z7xnJDdckZTuWHiC0qXU1J50CrndbBiKgvpM=' 
WHERE 
  key_id = '1d0717547b26bf8e44277411c30b5fc2b2c42ff1b992afe6671e43f6f28acb87' 
  AND (
    token = 'd6Xnib2Z7xnJDdckZTuWHiC0qXU1J50CrndbBiKgvpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038