UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SMaUivgEGtrb+PVRZXA3mFePe5Zp5toTVvSP6Naa21Q=' 
WHERE 
  key_id = '3f71ad7477e80027aa9b5ffbce9a2dcaf53cac800df26cccfb3b9c2aaea25d87' 
  AND (
    token = 'SMaUivgEGtrb+PVRZXA3mFePe5Zp5toTVvSP6Naa21Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039