UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vtUVRTiRdm2vM6ZF8JY4u0l4ZDynQgc6grN6uCLqczU=' 
WHERE 
  key_id = 'c790a69a9aa5f8f598ce0c05b54de659cdff25df926f0f8dea80a2f89aa62fea' 
  AND (
    token = 'vtUVRTiRdm2vM6ZF8JY4u0l4ZDynQgc6grN6uCLqczU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030