UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T8hBhopojlppiiML2Ego/k/OuvFnciSzy2YcLvuSGYA=' 
WHERE 
  key_id = '392a1cdc0e9d8fd4f63e5ac7d2c03ce84a3e1e90ed9583fdceef8542cc073e9b' 
  AND (
    token = 'T8hBhopojlppiiML2Ego/k/OuvFnciSzy2YcLvuSGYA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031