UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'da7L/TpjvDwqvmgiTYxT01DmtnUnnv8hIFddnhr6j20=' 
WHERE 
  key_id = '23c6a89d9bcdcaee7bac9760234e115c191634d360741adb710bbd462367fd43' 
  AND (
    token = 'da7L/TpjvDwqvmgiTYxT01DmtnUnnv8hIFddnhr6j20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026