UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D0znw+kKVnNH4jYIChh45zVBjIfg2YFLW6w0kPh1+48=' 
WHERE 
  key_id = 'e4282513c7038281db87221233221360a35866da5ac4192b40a652aa17cb5515' 
  AND (
    token = 'D0znw+kKVnNH4jYIChh45zVBjIfg2YFLW6w0kPh1+48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035