UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HbsBpL5TAaXLbSHiOnPLNzUdVpoAqCZWsh2ZSoo6wVM=' 
WHERE 
  key_id = '8cdcf665ce144ee77732972f814fec3d690965f387076792fd8eda054f0e37a5' 
  AND (
    token = 'HbsBpL5TAaXLbSHiOnPLNzUdVpoAqCZWsh2ZSoo6wVM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033