UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tuT9ttwQDR/E7DTT0KPk03rXG1tpoh0p20KvHyT+Dog=' 
WHERE 
  key_id = 'ee026610ec27fa121bfc95ed3bfe19382dc13b4c8785bbeb2cd235b9a12fe7ff' 
  AND (
    token = 'tuT9ttwQDR/E7DTT0KPk03rXG1tpoh0p20KvHyT+Dog=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031