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

Query time 0.00026