UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hhqGKRt3P1djD/9Wy9M0M+DVV+jBlzDBxFo1ZwVitxM=' 
WHERE 
  key_id = '4e3d599ebc15a71307b3b65f88d1a69339f3142923ea09a3a26757feab9dc7ee' 
  AND (
    token = 'hhqGKRt3P1djD/9Wy9M0M+DVV+jBlzDBxFo1ZwVitxM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024